<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>腾讯订单查询</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
<#include "../template/template_editPage.ftl">
<#include "../template/include/assign.ftl">
<#include "../template/include/source.ftl">
    <link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        .page {
            float: right;
            padding-top: 15px;
            margin-right: 15px;
        }
    </style>

</head>
<body class="list">
<script type="text/javascript">
    $().ready(function () {

        var $validateErrorContainer = $("#validateErrorContainer");
        var $validateErrorLabelContainer = $("#validateErrorContainer ul");
        var $validateForm = $("#inputForm");
        var $tab = $("#tab");
        // Tab效果
        $tab.tabs(".tabContent", {
            tabs:"input"
        });

        // 表单验证
        $validateForm.validate({
            errorContainer:$validateErrorContainer,
            errorLabelContainer:$validateErrorLabelContainer,
            wrapper:"li",
            errorClass:"validateError",
            ignoreTitle:true,
            rules:{
                "orderId":{
                    required:true
                },
                "tran_date":{
                    required:true
                }

            },
            messages:{
                "orderId":{
                    required:"请输入订单号!"
                },
                "tran_date":{
                    required:"请选择交易日期!"
                }

            },
            submitHandler:function (form) {
                //$(form).find(":submit").attr("disabled", true);
                form.submit();
            }
        });
    <#if actionErrors?? && (actionErrors?size > 0)>
        $.dialog({type:"warn", content:"<#list errorMessages as list>${list}<br></#list>",
            modal:true, autoCloseTime:3000});
    </#if>

    });


</script>
<div class="body">
    <div class="listBar">
        <h1><span class="icon">&nbsp;</span>腾讯订单查询&nbsp;</h1>
    </div>
    <div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
        <div class="validateErrorTitle" id="validateErrorTitle">以下信息填写有误,请重新填写</div>
        <ul></ul>
    </div>
    <form id="inputForm" class="validate" action="${web_base}/game/tencent!orderList.htm" method="post">
        <div class="operateBar">
            <label>请输入:</label>
            平台订单编号：<input type="text" id="orderId" name="orderId"
                           value="<#if tencent??>${(tencent.tran_seq)!}</#if>" onkeyup="this.value=this.value.replace(/\D/g,'')"
                           onafterpaste="this.value=this.value.replace(/\D/g,'')"/>*
           交易日期： <input type="text"  name="tran_date"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                           value="<#if tencent??>${(tencent.tran_date)!}</#if>" class="Wdate" >*
            <input type="submit" id="searchButton" class="addButton" value="查询"/>
                         &nbsp;&nbsp;&nbsp;&nbsp;
                          说明：腾讯只支持查询最近2日内交易记录
        </div>
    </form>
    <table class="listTable">
        <tr>
            <th>
                <span class="sort" name="tran_seq">手拉手订单编号</span>
            </th>
            <th>
                <span class="sort" name="mch_id">商业号（工号）</span>
            </th>
            <th>
                <span class="sort" name="order_status">状态</span>
            </th>
            <th>
                <span class="sort" name="ret">返回码</span>
            </th>
            <th>
                <span class="sort" name="retDes">返回码描述</span>
            </th>
            <th>
                <span class="sort" name="ret_msg">描述</span>
            </th>
        </tr>
    <#if tencent??>
        <tr>
            <td>
                ${(tencent.tran_seq)!}
            </td>
            <td>
                ${(tencent.mch_id)!}
            </td>
             <#if tencent?? && tencent.ret == 0>
                <td>
                    <#if tencent?? && tencent.order_status == 0>
                        初始
                    <#elseif  tencent?? && tencent.order_status == 1>
                        完成，已扣款，已发货
                    <#elseif  tencent?? && tencent.order_status == 2>
                        未扣款，未发货
                    <#elseif  tencent?? && tencent.order_status == 3>
                        已扣款，发货不成功，系统会自动补发货
                    <#elseif  tencent?? && tencent.order_status == 4>
                        正在交易，已扣款，尚未发货
                    <#elseif  tencent?? && tencent.order_status == 6>
                        未扣款，未发货
                    </#if>
                </td>
            <#else>
            <td></td>
            </#if>
            <td>
                ${(tencent.ret )!}
            </td>
            <td>
                <#if tencent?? && tencent.ret == 0>
                    查询成功
                 <#elseif  tencent?? && tencent.ret == 4>
                     系统错误(指的是非在线卡支付逻辑的所有错误)
                <#elseif  tencent?? && tencent.ret == 100>
                    经销商未注册直通车
                <#elseif  tencent?? && tencent.ret == 110>
                    签名错误
                <#elseif  tencent?? && tencent.ret == 120>
                    IP不合法
                <#elseif  tencent?? && tencent.ret == 130>
                    订单不存在
                <#elseif  tencent?? && tencent.ret == 140>
                    直通车密钥不存在
                </#if>
            </td>
            <td>
                <#if tencent.ret_msg?? && tencent.ret_msg?length gte 50>
                <#--//截取输出文字的长度-->
                    ${tencent.ret_msg?substring(0,50)}...
                <#else>
                    ${(tencent.ret_msg )!}
                </#if>
            </td>
        </tr>
    </#if>
    </table>
<#if !tencent??>
<div class="noRecord">
    <span id="span"> 没有找到任何记录!</span>
</#if>
</div>
</div>

</body>
</html>